"use strict";

const __color__ = function(color, txt) {
  return `\x1b[${color}m${txt}\x1b[0m`;
};

/**
 * return `Black` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const black = function(txt) {
  return __color__(30, txt);
};

/**
 * return `Red` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const red = function(txt) {
  return __color__(31, txt);
};

/**
 * return `Green` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const green = function(txt) {
  return __color__(32, txt);
};

/**
 * return `Yellow` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const yellow = function(txt) {
  return __color__(33, txt);
};

/**
 * return `Blue` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const blue = function(txt) {
  return __color__(34, txt);
};

/**
 * return `Magenta`(品红, 洋红色) color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const magenta = function(txt) {
  return __color__(35, txt);
};

/**
 * return `Cyan`(青色, 蓝绿色) color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const cyan = function(txt) {
  return __color__(36, txt);
};

/**
 * return `White` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const white = function(txt) {
  return __color__(37, txt);
};

/**
 * return `Bright Black` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const brightBlack = function(txt) {
  return __color__(90, txt);
};

/**
 * return `Bright Red` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const brightRed = function(txt) {
  return __color__(91, txt);
};

/**
 * return `Bright Green` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const brightGreen = function(txt) {
  return __color__(92, txt);
};

/**
 * return `Bright Yellow` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const brightYellow = function(txt) {
  return __color__(93, txt);
};

/**
 * return `Bright Blue` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const brightBlue = function(txt) {
  return __color__(94, txt);
};

/**
 * return `Bright Magenta` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const brightMagenta = function(txt) {
  return __color__(95, txt);
};

/**
 * return `Bright Cyan` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const brightCyan = function(txt) {
  return __color__(96, txt);
};

/**
 * return `Bright White` color text
 * @param {string} txt  to be colored text.
 * @returns {string} colored text.
 */
const brightWhite = function(txt) {
  return __color__(97, txt);
};


module.exports = {
  black, red, green, yellow, blue, magenta, cyan, white,
  brightBlack, brightRed, brightGreen, brightYellow, brightBlue,
  brightMagenta, brightMagenta, brightCyan, brightWhite
}
